package cn.changein.framework.elasticsearch.document;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

/**

 */

@Data
@Document(indexName = "article", shards = 1)
public class ArticleDoc {

    /**
     * 标签
     */
    public static final String LABEL_IDS = "labels";

    /**
     * 地区
     */
    public static final String AREA_IDS = "areas";

    /**
     * 分类id
     */
    public static final String CATEGORY_ID = "categoryId";

    /**
     * 来源ID originateId
     */
    public static final String ORIGINATE_ID = "originateId";

    /**
     * 服役年限
     */
    public static final String service_age = "serviceAge";

    /**
     * 标签匹配次数
     */
    public static final String LABEL_TIMES = "labelTimes";

    @Id
    @Field(type = FieldType.Long)
    private Long id;

    @Field(type = FieldType.Text/*, analyzer = "ik_smart", searchAnalyzer = "ik_smart"*/)
    private String textContent;

    @Field(type = FieldType.Keyword)
    private List<String> labels;

    @Field(type = FieldType.Keyword)
    private List<String> areas;

    @Field(type = FieldType.Text/*, analyzer = "ik_smart", searchAnalyzer = "ik_smart"*/)
    private String title;

    @Field(type = FieldType.Text)
    private String description;

    @Field(type = FieldType.Long)
    private Long categoryId;

    @Field(type = FieldType.Integer)
    private Integer sortNo;

    @Field(type = FieldType.Long)
    private Long originateId;

    @Field(type = FieldType.Integer)
    private Integer serviceAge;


    /**
     * 标签
     */
    @Field(type = FieldType.Text/*, analyzer = "ik_smart", searchAnalyzer = "ik_smart"*/)
    private String labelTimes;

    /**
     * 按照点击量排序
     */
    @Field(type = FieldType.Long)
    private Long clickQuantity;

    /**
     * 按照最新时间
     */
    @Field(type = FieldType.Date)
    private Date articleTime;
}
